package com.etone.smartAudit.mapstruct;

import com.etone.smartAudit.domain.FieldCase;
import com.etone.smartAudit.dto.fieldCase.FieldCaseDTO;
import org.mapstruct.*;

/**
 * @author: sovy
 * @date: 2020/8/19
 * @description:
 */
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface FieldCaseMapstruct {

    @Mappings({
            @Mapping(target = "cover", expression = "java(fieldCaseDTO.getCover() == null ? null : com.alibaba.fastjson.JSON.toJSONString(fieldCaseDTO.getCover()))"),
            @Mapping(target = "files", expression = "java(fieldCaseDTO.getFiles() == null ? null : com.alibaba.fastjson.JSON.toJSONString(fieldCaseDTO.getFiles()))")
    })
    void copyFieldCase(@MappingTarget FieldCase fieldCase, FieldCaseDTO fieldCaseDTO);
}
